<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>qspips: xqspips_g128_flash_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">qspips
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xqspips__g128__flash__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">xqspips_g128_flash_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the QSPI driver (<a class="el" href="struct_x_qspi_ps.html" title="The XQspiPs driver instance data. ">XQspiPs</a>) with a serial Flash device greater than 128Mb. </p>
<p>The example writes to flash and reads it back in I/O mode. This examples performs some transfers in Auto mode and Manual start mode, to illustrate the modes available. It is recommended to use Manual CS + Auto start for best performance. This example illustrates single, parallel and stacked modes. Both the flash devices have to be of the same make and size. The hardware which this example runs on, must have a serial Flash (Micron N25Q or Spansion S25FL) for it to run. This example has been tested with the Micron Serial Flash (N25Q256, N25Q512 &amp; N25Q00AA) and Spansion (S25FL256 &amp; S25FL512)</p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>None.</p>
<pre>
 MODIFICATION HISTORY:</pre><pre> Ver   Who Date     Changes
</p>
<hr/>
<p>
 2.02a hk  05/07/13 First release
       raw 12/10/15 Added support for Macronix 256Mb and 1Gb flash parts
       ms  04/05/17 Modified Comment lines in functions to
                    recognize it as documentation block for doxygen
                    generation.
                tjs     06/16/17 Added support for IS25LP256D flash part (PR-4650)
 3.10 akm 08/17/22  Fix logical error in NumSect calculation.
 3.11 akm 07/10/23 Add support for system device-tree flow for example.
 3.14 sb  03/25/25 Fixed gcc and g++ warnings.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a124f20a4738c2c9c86d92590dab986e3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a124f20a4738c2c9c86d92590dab986e3">QspiG128FlashExample</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiInstancePtr, u16 QspiDeviceId)</td></tr>
<tr class="memdesc:a124f20a4738c2c9c86d92590dab986e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">The purpose of this function is to illustrate how to use the <a class="el" href="struct_x_qspi_ps.html" title="The XQspiPs driver instance data. ">XQspiPs</a> device driver in single, parallel and stacked modes using flash devices greater than 128Mb.  <a href="#a124f20a4738c2c9c86d92590dab986e3">More...</a><br/></td></tr>
<tr class="separator:a124f20a4738c2c9c86d92590dab986e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aca1ee50e3326d7a6bf10276be2d21391"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#aca1ee50e3326d7a6bf10276be2d21391">FlashErase</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u32 Address, u32 ByteCount, u8 *WriteBfrPtr)</td></tr>
<tr class="memdesc:aca1ee50e3326d7a6bf10276be2d21391"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function erases the sectors in the serial Flash connected to the QSPI interface.  <a href="#aca1ee50e3326d7a6bf10276be2d21391">More...</a><br/></td></tr>
<tr class="separator:aca1ee50e3326d7a6bf10276be2d21391"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1275835da99a222bbf97b10723925116"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a1275835da99a222bbf97b10723925116">FlashWrite</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u32 Address, u32 ByteCount, u8 Command, u8 *WriteBfrPtr)</td></tr>
<tr class="memdesc:a1275835da99a222bbf97b10723925116"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function writes to the serial Flash connected to the QSPI interface.  <a href="#a1275835da99a222bbf97b10723925116">More...</a><br/></td></tr>
<tr class="separator:a1275835da99a222bbf97b10723925116"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a36c56a9a6494163d17ea1a06312c6dec"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a36c56a9a6494163d17ea1a06312c6dec">FlashReadID</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u8 *WriteBfrPtr, u8 *ReadBfrPtr)</td></tr>
<tr class="memdesc:a36c56a9a6494163d17ea1a06312c6dec"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function reads serial Flash ID connected to the SPI interface.  <a href="#a36c56a9a6494163d17ea1a06312c6dec">More...</a><br/></td></tr>
<tr class="separator:a36c56a9a6494163d17ea1a06312c6dec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a24950639bf563beb091a0bbf1e51bb61"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a24950639bf563beb091a0bbf1e51bb61">FlashRead</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u32 Address, u32 ByteCount, u8 Command, u8 *WriteBfrPtr, u8 *ReadBfrPtr)</td></tr>
<tr class="memdesc:a24950639bf563beb091a0bbf1e51bb61"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function performs an I/O read.  <a href="#a24950639bf563beb091a0bbf1e51bb61">More...</a><br/></td></tr>
<tr class="separator:a24950639bf563beb091a0bbf1e51bb61"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f034b18fdbb5e1217e3aa862ec91cf0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a0f034b18fdbb5e1217e3aa862ec91cf0">SendBankSelect</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u8 *WriteBfrPtr, u32 BankSel)</td></tr>
<tr class="memdesc:a0f034b18fdbb5e1217e3aa862ec91cf0"><td class="mdescLeft">&#160;</td><td class="mdescRight">This functions selects the current bank.  <a href="#a0f034b18fdbb5e1217e3aa862ec91cf0">More...</a><br/></td></tr>
<tr class="separator:a0f034b18fdbb5e1217e3aa862ec91cf0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6bad398ec8a0c070c283638e0e955bdd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a6bad398ec8a0c070c283638e0e955bdd">BulkErase</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u8 *WriteBfrPtr)</td></tr>
<tr class="memdesc:a6bad398ec8a0c070c283638e0e955bdd"><td class="mdescLeft">&#160;</td><td class="mdescRight">This functions performs a bulk erase operation when the flash device has a single die.  <a href="#a6bad398ec8a0c070c283638e0e955bdd">More...</a><br/></td></tr>
<tr class="separator:a6bad398ec8a0c070c283638e0e955bdd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a180817fa33a33333552ffc90baa3bcfa"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a180817fa33a33333552ffc90baa3bcfa">DieErase</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u8 *WriteBfrPtr)</td></tr>
<tr class="memdesc:a180817fa33a33333552ffc90baa3bcfa"><td class="mdescLeft">&#160;</td><td class="mdescRight">This functions performs a die erase operation on all the die in the flash device.  <a href="#a180817fa33a33333552ffc90baa3bcfa">More...</a><br/></td></tr>
<tr class="separator:a180817fa33a33333552ffc90baa3bcfa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8dcc4059afd09dacccfa2ab80669aa91"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a8dcc4059afd09dacccfa2ab80669aa91">GetRealAddr</a> (<a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *QspiPtr, u32 Address)</td></tr>
<tr class="memdesc:a8dcc4059afd09dacccfa2ab80669aa91"><td class="mdescLeft">&#160;</td><td class="mdescRight">This functions translates the address based on the type of interconnection.  <a href="#a8dcc4059afd09dacccfa2ab80669aa91">More...</a><br/></td></tr>
<tr class="separator:a8dcc4059afd09dacccfa2ab80669aa91"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to call the QSPI Flash example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a3542e5a3c9c7b059411efb09e844f62e"><td class="memItemLeft" align="right" valign="top">FlashInfo&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xqspips__g128__flash__example_8c.html#a3542e5a3c9c7b059411efb09e844f62e">Flash_Config_Table</a> [34]</td></tr>
<tr class="memdesc:a3542e5a3c9c7b059411efb09e844f62e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flash Config Table.  <a href="#a3542e5a3c9c7b059411efb09e844f62e">More...</a><br/></td></tr>
<tr class="separator:a3542e5a3c9c7b059411efb09e844f62e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a6bad398ec8a0c070c283638e0e955bdd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BulkErase </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>WriteBfrPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This functions performs a bulk erase operation when the flash device has a single die. </p>
<p>Works for both Spansion and Micron</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">WriteBfrPtr</td><td>is the pointer to command+address to be sent</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="group__qspips.html#ga92bcb2ff87e82a4f27e9a49db023d08d">XQspiPs_PolledTransfer()</a>.</p>

<p>Referenced by <a class="el" href="xqspips__g128__flash__example_8c.html#aca1ee50e3326d7a6bf10276be2d21391">FlashErase()</a>.</p>

</div>
</div>
<a class="anchor" id="a180817fa33a33333552ffc90baa3bcfa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void DieErase </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>WriteBfrPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This functions performs a die erase operation on all the die in the flash device. </p>
<p>This function uses the die erase command for Micron 512Mbit and 1Gbit</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">WriteBfrPtr</td><td>is the pointer to command+address to be sent</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xqspips__g128__flash__example_8c.html#a3542e5a3c9c7b059411efb09e844f62e">Flash_Config_Table</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a0f034b18fdbb5e1217e3aa862ec91cf0">SendBankSelect()</a>, and <a class="el" href="group__qspips.html#ga92bcb2ff87e82a4f27e9a49db023d08d">XQspiPs_PolledTransfer()</a>.</p>

<p>Referenced by <a class="el" href="xqspips__g128__flash__example_8c.html#aca1ee50e3326d7a6bf10276be2d21391">FlashErase()</a>.</p>

</div>
</div>
<a class="anchor" id="aca1ee50e3326d7a6bf10276be2d21391"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void FlashErase </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ByteCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>WriteBfrPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function erases the sectors in the serial Flash connected to the QSPI interface. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">Address</td><td>contains the address of the first sector which needs to be erased. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>contains the total size to be erased. </td></tr>
    <tr><td class="paramname">WriteBfrPtr</td><td>is Pointer to the write buffer (which is to be transmitted)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xqspips__g128__flash__example_8c.html#a6bad398ec8a0c070c283638e0e955bdd">BulkErase()</a>, <a class="el" href="struct_x_qspi_ps.html#a2d62333af44caf7cd89779d6b2c2719a">XQspiPs::Config</a>, <a class="el" href="struct_x_qspi_ps___config.html#ac79a340f28f24fce2a543c77a2921755">XQspiPs_Config::ConnectionMode</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a180817fa33a33333552ffc90baa3bcfa">DieErase()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a3542e5a3c9c7b059411efb09e844f62e">Flash_Config_Table</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a8dcc4059afd09dacccfa2ab80669aa91">GetRealAddr()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a0f034b18fdbb5e1217e3aa862ec91cf0">SendBankSelect()</a>, <a class="el" href="group__qspips.html#gabda4f4e269e54217292622433e8ba8f7">XQspiPs_GetLqspiConfigReg</a>, <a class="el" href="group__qspips.html#ga43ea3e35e6c6a57aba2301e0a3de9e8e">XQSPIPS_LQSPI_CR_U_PAGE_MASK</a>, <a class="el" href="group__qspips.html#ga92bcb2ff87e82a4f27e9a49db023d08d">XQspiPs_PolledTransfer()</a>, <a class="el" href="group__qspips.html#ga3d5c1b501b5dc6e14297682279bbfee2">XQspiPs_SetLqspiConfigReg</a>, and <a class="el" href="group__qspips.html#ga8eb7e89e789b707718444125358167e9">XQspiPs_SetSlaveSelect()</a>.</p>

</div>
</div>
<a class="anchor" id="a24950639bf563beb091a0bbf1e51bb61"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void FlashRead </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ByteCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>WriteBfrPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>ReadBfrPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function performs an I/O read. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">Address</td><td>contains the address of the first sector which needs to be erased. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>contains the total size to be erased. </td></tr>
    <tr><td class="paramname">Command</td><td>is the command used to read data from the flash. Supports normal, fast, dual and quad read commands. </td></tr>
    <tr><td class="paramname">WriteBfrPtr</td><td>is pointer to the write buffer which contains data to be transmitted </td></tr>
    <tr><td class="paramname">ReadBfrPtr</td><td>is pointer to the read buffer to which valid received data should be written</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>none.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xqspips__g128__flash__example_8c.html#a3542e5a3c9c7b059411efb09e844f62e">Flash_Config_Table</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a8dcc4059afd09dacccfa2ab80669aa91">GetRealAddr()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a0f034b18fdbb5e1217e3aa862ec91cf0">SendBankSelect()</a>, and <a class="el" href="group__qspips.html#ga92bcb2ff87e82a4f27e9a49db023d08d">XQspiPs_PolledTransfer()</a>.</p>

</div>
</div>
<a class="anchor" id="a36c56a9a6494163d17ea1a06312c6dec"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int FlashReadID </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>WriteBfrPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>ReadBfrPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function reads serial Flash ID connected to the SPI interface. </p>
<p>It then deduces the make and size of the flash and obtains the connection mode to point to corresponding parameters in the flash configuration table. The flash driver will function based on this and it presently supports Micron and Spansion - 128, 256 and 512Mbit and Winbond 128Mbit</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">WriteBfrPtr</td><td>is pointer to the write buffer (which is to be transmitted) </td></tr>
    <tr><td class="paramname">ReadBfrPtr</td><td>is pointer to the read buffer to which valid received data should be written.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if read id, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="struct_x_qspi_ps.html#a2d62333af44caf7cd89779d6b2c2719a">XQspiPs::Config</a>, <a class="el" href="struct_x_qspi_ps___config.html#ac79a340f28f24fce2a543c77a2921755">XQspiPs_Config::ConnectionMode</a>, and <a class="el" href="group__qspips.html#ga92bcb2ff87e82a4f27e9a49db023d08d">XQspiPs_PolledTransfer()</a>.</p>

</div>
</div>
<a class="anchor" id="a1275835da99a222bbf97b10723925116"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void FlashWrite </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ByteCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>WriteBfrPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function writes to the serial Flash connected to the QSPI interface. </p>
<p>All the data put into the buffer must be in the same page of the device with page boundaries being on 256 byte boundaries.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">Address</td><td>contains the address to write data to in the Flash. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>contains the number of bytes to write. </td></tr>
    <tr><td class="paramname">Command</td><td>is the command used to write data to the flash. QSPI device supports only Page Program command to write data to the flash. </td></tr>
    <tr><td class="paramname">WriteBfrptr</td><td>is the pointer to the write buffer(which is to be transmitted)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xqspips__g128__flash__example_8c.html#a3542e5a3c9c7b059411efb09e844f62e">Flash_Config_Table</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a8dcc4059afd09dacccfa2ab80669aa91">GetRealAddr()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a0f034b18fdbb5e1217e3aa862ec91cf0">SendBankSelect()</a>, and <a class="el" href="group__qspips.html#ga92bcb2ff87e82a4f27e9a49db023d08d">XQspiPs_PolledTransfer()</a>.</p>

</div>
</div>
<a class="anchor" id="a8dcc4059afd09dacccfa2ab80669aa91"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 GetRealAddr </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Address</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This functions translates the address based on the type of interconnection. </p>
<p>In case of stacked, this function asserts the corresponding slave select.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">Address</td><td>which is to be accessed (for erase, write or read)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>RealAddr is the translated address - for single it is unchanged; for stacked, the lower flash size is subtracted; for parallel the address is divided by 2.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="struct_x_qspi_ps.html#a2d62333af44caf7cd89779d6b2c2719a">XQspiPs::Config</a>, <a class="el" href="struct_x_qspi_ps___config.html#ac79a340f28f24fce2a543c77a2921755">XQspiPs_Config::ConnectionMode</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a3542e5a3c9c7b059411efb09e844f62e">Flash_Config_Table</a>, <a class="el" href="group__qspips.html#gabda4f4e269e54217292622433e8ba8f7">XQspiPs_GetLqspiConfigReg</a>, <a class="el" href="group__qspips.html#ga43ea3e35e6c6a57aba2301e0a3de9e8e">XQSPIPS_LQSPI_CR_U_PAGE_MASK</a>, <a class="el" href="group__qspips.html#ga3d5c1b501b5dc6e14297682279bbfee2">XQspiPs_SetLqspiConfigReg</a>, and <a class="el" href="group__qspips.html#ga8eb7e89e789b707718444125358167e9">XQspiPs_SetSlaveSelect()</a>.</p>

<p>Referenced by <a class="el" href="xqspips__g128__flash__example_8c.html#aca1ee50e3326d7a6bf10276be2d21391">FlashErase()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a24950639bf563beb091a0bbf1e51bb61">FlashRead()</a>, and <a class="el" href="xqspips__g128__flash__example_8c.html#a1275835da99a222bbf97b10723925116">FlashWrite()</a>.</p>

</div>
</div>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function to call the QSPI Flash example. </p>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="xqspips__g128__flash__example_8c.html#a124f20a4738c2c9c86d92590dab986e3">QspiG128FlashExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a124f20a4738c2c9c86d92590dab986e3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int QspiG128FlashExample </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiInstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>QspiDeviceId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The purpose of this function is to illustrate how to use the <a class="el" href="struct_x_qspi_ps.html" title="The XQspiPs driver instance data. ">XQspiPs</a> device driver in single, parallel and stacked modes using flash devices greater than 128Mb. </p>
<p>This function reads and writes data in I/O mode.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiInstancePtr</td><td>is a pointer to the QSPIPS driver to use. </td></tr>
    <tr><td class="paramname">QspiDeviceId</td><td>is the XPAR_&lt;QSPIPS_instance&gt;_DEVICE_ID value from xparameters.h</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="struct_x_qspi_ps___config.html#a26d9a68f7ad821671044d35e5e8a851e">XQspiPs_Config::BaseAddress</a>, <a class="el" href="struct_x_qspi_ps___config.html#ac79a340f28f24fce2a543c77a2921755">XQspiPs_Config::ConnectionMode</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a3542e5a3c9c7b059411efb09e844f62e">Flash_Config_Table</a>, <a class="el" href="xqspips__dual__flash__lqspi__example_8c.html#a1cb26e7de1e53fe8bd6c4e1d3a9e8ecc">FlashErase()</a>, <a class="el" href="xqspips__dual__flash__lqspi__example_8c.html#af28c30bb35e57c70a8b73c8796fb3fb1">FlashRead()</a>, <a class="el" href="xqspips__dual__flash__lqspi__example_8c.html#aa424c9f6fee5f08746f8f3233b7467ed">FlashReadID()</a>, <a class="el" href="xqspips__dual__flash__lqspi__example_8c.html#aa4691616d85f33bb068a7e9740249b86">FlashWrite()</a>, <a class="el" href="group__qspips.html#gaf348b6ee07c1e3e7d01857a789e658d4">XQspiPs_CfgInitialize()</a>, <a class="el" href="group__qspips.html#ga79d211f4165bfe188163de14f9b6f80b">XQSPIPS_CLK_PRESCALE_8</a>, <a class="el" href="group__qspips.html#ga4c42b31270f32f0dbaecd9d582ed3287">XQSPIPS_FORCE_SSELECT_OPTION</a>, <a class="el" href="group__qspips.html#ga272d8eb4928d9c3da9eaad379e7bd5a9">XQSPIPS_HOLD_B_DRIVE_OPTION</a>, <a class="el" href="group__qspips.html#ga3f4fa51f1ba6d49a6ec9e9b079fc4fd7">XQspiPs_LookupConfig()</a>, <a class="el" href="group__qspips.html#gab11b1e374c5ed9fbfc9ac9e81cad3e3e">XQSPIPS_MANUAL_START_OPTION</a>, <a class="el" href="group__qspips.html#ga0975016f42a8249235098408ab0c9da6">XQspiPs_SelfTest()</a>, <a class="el" href="group__qspips.html#gaafc1b751d17216ad037b7dd167f073f0">XQspiPs_SetClkPrescaler()</a>, <a class="el" href="group__qspips.html#ga3d5c1b501b5dc6e14297682279bbfee2">XQspiPs_SetLqspiConfigReg</a>, <a class="el" href="group__qspips.html#ga425ce03f19417a386c6882efb79641df">XQspiPs_SetOptions()</a>, and <a class="el" href="group__qspips.html#ga8eb7e89e789b707718444125358167e9">XQspiPs_SetSlaveSelect()</a>.</p>

<p>Referenced by <a class="el" href="xqspips__g128__flash__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a0f034b18fdbb5e1217e3aa862ec91cf0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SendBankSelect </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_qspi_ps.html">XQspiPs</a> *&#160;</td>
          <td class="paramname"><em>QspiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>WriteBfrPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>BankSel</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This functions selects the current bank. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">QspiPtr</td><td>is a pointer to the QSPI driver component to use. </td></tr>
    <tr><td class="paramname">WriteBfrPtr</td><td>to the write buffer which contains data to be transmitted. </td></tr>
    <tr><td class="paramname">BankSel</td><td>is the bank to be selected in the flash device(s).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if bank selected, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="group__qspips.html#ga92bcb2ff87e82a4f27e9a49db023d08d">XQspiPs_PolledTransfer()</a>.</p>

<p>Referenced by <a class="el" href="xqspips__g128__flash__example_8c.html#a180817fa33a33333552ffc90baa3bcfa">DieErase()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#aca1ee50e3326d7a6bf10276be2d21391">FlashErase()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a24950639bf563beb091a0bbf1e51bb61">FlashRead()</a>, and <a class="el" href="xqspips__g128__flash__example_8c.html#a1275835da99a222bbf97b10723925116">FlashWrite()</a>.</p>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a3542e5a3c9c7b059411efb09e844f62e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">FlashInfo Flash_Config_Table[34]</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Flash Config Table. </p>

<p>Referenced by <a class="el" href="xqspips__g128__flash__example_8c.html#a180817fa33a33333552ffc90baa3bcfa">DieErase()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#aca1ee50e3326d7a6bf10276be2d21391">FlashErase()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a24950639bf563beb091a0bbf1e51bb61">FlashRead()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a1275835da99a222bbf97b10723925116">FlashWrite()</a>, <a class="el" href="xqspips__g128__flash__example_8c.html#a8dcc4059afd09dacccfa2ab80669aa91">GetRealAddr()</a>, and <a class="el" href="xqspips__g128__flash__example_8c.html#a124f20a4738c2c9c86d92590dab986e3">QspiG128FlashExample()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
